package com.marketing.auth.dto;

import java.util.List;
import java.util.Set;

/**
 * 用户登录后的完整信息DTO，包含角色和权限
 */
public class UserPermissionDto {
    
    private Long id;
    private String username;
    private String email;
    private String nickname;
    private String avatar;
    private String phone;
    private Integer status;
    private String role; // 主要角色（保持向后兼容）
    private String department;
    private String position;
    private Integer loginCount;
    
    // RBAC扩展信息
    private List<RoleDto> roles; // 用户的所有角色
    private List<PermissionDto> permissions; // 用户的所有权限
    private Set<String> permissionCodes; // 权限编码集合，用于快速权限检查
    private List<ResourceDto> menus; // 用户可访问的菜单资源

    public UserPermissionDto() {}

    // Getters and Setters
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public Integer getLoginCount() {
        return loginCount;
    }

    public void setLoginCount(Integer loginCount) {
        this.loginCount = loginCount;
    }

    public List<RoleDto> getRoles() {
        return roles;
    }

    public void setRoles(List<RoleDto> roles) {
        this.roles = roles;
    }

    public List<PermissionDto> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<PermissionDto> permissions) {
        this.permissions = permissions;
    }

    public Set<String> getPermissionCodes() {
        return permissionCodes;
    }

    public void setPermissionCodes(Set<String> permissionCodes) {
        this.permissionCodes = permissionCodes;
    }

    public List<ResourceDto> getMenus() {
        return menus;
    }

    public void setMenus(List<ResourceDto> menus) {
        this.menus = menus;
    }

    @Override
    public String toString() {
        return "UserPermissionDto{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", email='" + email + '\'' +
                ", nickname='" + nickname + '\'' +
                ", avatar='" + avatar + '\'' +
                ", phone='" + phone + '\'' +
                ", status=" + status +
                ", role='" + role + '\'' +
                ", department='" + department + '\'' +
                ", position='" + position + '\'' +
                ", loginCount=" + loginCount +
                ", roles=" + roles +
                ", permissions=" + permissions +
                ", permissionCodes=" + permissionCodes +
                ", menus=" + menus +
                '}';
    }
}